using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MainCharacter : MonoBehaviour
{
    public CharacterState _idle;
    public CharacterState _move;
    public CharacterState _pick;
    public CharacterState _interact;

    private CharacterState _currentState;

    public Rigidbody2D _RB2D;
    public float _speed;

    private void Start()
    {
        _RB2D = GetComponent<Rigidbody2D>();
        _idle = new Idle(this);
        _move = new Move(this);
        _pick = new Pick(this);
        _interact = new Interact(this);
        _currentState = _idle;
        _currentState.Enter();
    }

    private void Update()
    {
        _currentState.Update();
    }

    public void Switch(CharacterState nextState)
    {
        _currentState.Exit();
        _currentState = nextState;
        _currentState.Enter();
    }
}


